package com.zst.demo1.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zst.demo1.mapper.UserRoleMapper;
import com.zst.demo1.po.UserRolePO;
import com.zst.demo1.service.IUserRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
@Slf4j
public class UserRoleServiceImpl implements IUserRoleService {
    @Autowired
    UserRoleMapper userRoleMapper;

    @Override
    public Optional<UserRolePO> getUserRoleById(Long roleId) {
        LambdaQueryWrapper<UserRolePO> query = Wrappers.lambdaQuery();
        query.eq(UserRolePO::getRoleId, roleId);
        UserRolePO userRolePO = userRoleMapper.selectOne(query);
        return Optional.of(userRolePO);
    }
}
